package com.itheima.test4lambdayoucanyoufan;

public class Demo7 {
    public static void main(String[] args) {
        useCalculate(new Calculate() {
            @Override
            public int getNumber(int a, int b) {
                return a + b;
            }
        });
        System.out.println("-------------------");
        useCalculate((a, b) -> a * b);
    }

    public static void useCalculate(Calculate calculate) {
        int result = calculate.getNumber(10, 20);
        System.out.println(result);
    }
}

interface Calculate {
    int getNumber(int a, int b);
}
